import React, { Component } from 'react';
//导入路由
import {Switch,Route,Redirect} from 'react-router-dom';
const Index1=React.lazy(()=> import('../view/index/Index.jsx'))
const Login=React.lazy(()=>import('../view/login/Index.jsx'))
const Register=React.lazy(()=>import('../view/register/Index'))
class Router extends Component {
    render() {
        return (
            <div>
                <React.Suspense fallback={<mark>loading...</mark>}>
                    <Switch>
                        <Route path="/login" exact component={Login}></Route>
                        <Route path="/index" component={Index1}></Route>
                        <Route path="/register" component={Register}></Route>
                        <Redirect path="/" exact to='/index/home'></Redirect>
                    </Switch>   
                </React.Suspense>
            </div>
        );
    }
}

export default Router;